#include<bits/stdc++.h>
#include "graph.h"
using namespace std;
const int N=205;
int n,k,rt,tt;
int rd[N],fa[N],tr[N][N],g[N][N],e[N][N],id[N][N],ans[N];
int dfs(int f){
	int x=++n;rd[x]=NumberOfRoads(),fa[x]=LastRoad(),g[x][fa[x]]=f;
	for(int i=1;i<=rd[x];i++){
		if(i==fa[x])continue;
		Move(i,2),tr[x][i]=Color();
		if(tr[x][i]==1)g[x][i]=dfs(x);
		else if(tr[x][i]==2)id[x][i]=LastRoad(),Move(LastRoad(),Color());
		else Move(LastRoad(),Color());
	}if(x>1)Move(fa[x],3);
	return x;
}
void slv(int x){
	for(int i=1;i<=rd[x];i++){
		if(i==fa[x])continue;
		if(tr[x][i]==1)Move(i,x/k%3+1),slv(g[x][i]);
		else if(tr[x][i]==2){
			Move(i,x/k%3+1);
			g[x][i]+=(Color()-1)*k;
			Move(LastRoad(),Color());
		}
	}if(x>1)Move(fa[x],x/k%3+1);
}
void Inspect(int R){
	rt=dfs(0),k=1,tt=5;
	while(tt--)slv(rt),k*=3;
	memset(e,0x3f,sizeof(e));
	for(int i=1;i<=n;i++){
		for(int j=1;j<=rd[i];j++)if(g[i][j])g[g[i][j]][id[i][j]]=i;
	}
	for(int i=1;i<=n;i++){
		e[i][i]=0;
		for(int j=1;j<=rd[i];j++)e[i][g[i][j]]=1;
	}
	for(int k=1;k<=n;k++){
		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++)e[i][j]=min(e[i][j],e[i][k]+e[k][j]);
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++)assert(e[i][j]<=n),ans[e[i][j]]++;
	}
	for(int i=1;i<=R;i++)Answer(i,ans[i]);
}